package com.alageek.study.controller;

import com.alageek.study.entity.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class HumanResourceHandler {
    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/consumer/ribbon/get/employee")
    public Employee getEmployeeRemote(){
        //String host = "http://localhost:1000";
        String host = "http://alageek-provider";
        String url = "/provider/get/employee/remote";
        return restTemplate.getForObject(host+url, Employee.class);
    }
}
